#include <iostream>
#include <string>
#include <map>

class OAuth2Server {
private:
    std::map<std::string, std::string> clients;
    std::map<std::string, std::string> tokens;

public:
    OAuth2Server() {
        // 初始化测试客户端
        clients["devops-platform"] = "secret123";
        std::cout << "OAuth2 Server initialized for VC++2005" << std::endl;
    }

    std::string GenerateToken(const std::string& clientId) {
        std::string token = "vc2005_token_" + clientId + "_" + GetTimestamp();
        tokens[token] = clientId;
        return token;
    }

    bool ValidateToken(const std::string& token) {
        return tokens.find(token) != tokens.end();
    }

    void ShowStatus() {
        std::cout << "OAuth2 Server Status:" << std::endl;
        std::cout << "  Clients: " << clients.size() << std::endl;
        std::cout << "  Active Tokens: " << tokens.size() << std::endl;
        std::cout << "  Compiler: VC++2005" << std::endl;
    }

private:
    std::string GetTimestamp() {
        return "20251031";
    }
};
